/*
 * 创建时间：2015年7月27日 
 */
package com.tuanzi.loan.workflow.entity;

import java.io.Serializable;
import java.util.Date;

import lombok.Data;

/**
 * @author Ray
 * @date 2018/01/17
 */
@Data
public class ProcessInstance implements Serializable {

	private static final long serialVersionUID = -2579776130252555883L;

	/** 流程实例id */
	private String id;

	/** 业务编号 */
	private String businessKey;

	/** 流程定义id */
	private String processDefinitionId;

	/** 流程定义名称 */
	private String processDefinitionName;

	/** 流程启动时间 */
	private Date startTime;

	/** 流程结束时间 */
	private Date endTime;

	/** 流程持续时间 */
	private Long durationInMillis;

	/** 流程创建人帐号 */
	private String startUserId;

	/** 流程创建人名称 */
	private String startUserName;

	/** 流程启动节点 */
	private String startActivityId;

	/** 流程实例删除原因 */
	private String deleteReason;

	/** 流程实例标题 */
	private String name;

	/** 业务种类id */
	private String category;

	/** 业务种类名称 */
	private String categoryName;

	/** 流程状态：activate-执行中；suspend-已挂起；ending-已结束 */
	private String status;

	private String endActId;

	public static final String PROCESS_STATUS_ACTIVATE = "activate";
	public static final String PROCESS_STATUS_SUSPEND = "suspend";
	public static final String PROCESS_STATUS_ENDING = "ending";
	public static final String PROCESS_STATUS_ENDING_REDO_DISABLE = "ending-redo-disable";
	public static final String PROCESS_STATUS_DELETED = "deleted";

	public String getStatusStr() {
		if (PROCESS_STATUS_ACTIVATE.equalsIgnoreCase(status)) {
			return "执行中";
		} else if (PROCESS_STATUS_ENDING.equalsIgnoreCase(status)) {
			return "已结束";
		} else if (PROCESS_STATUS_SUSPEND.equalsIgnoreCase(status)) {
			return "已挂起";
		} else {
			return "未知";
		}
	}

}
